Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+โ†‘Ctrl+โ†“to navigate, Ctrl+๐Ÿ–ฑ๏ธto focus. On Mac, use Cmdinstead of Ctrl.
import Mathlib.Data.Vector
import Mathlib.Data.Bitvec.Basic
import Mathlib.Algebra.Group.InjSurj
import Mathlib.Tactic.Ring
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.ZMod.Basic
import Mathlib.Order.Basic

namespace Vector

instance: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ GetElem (Vector ฮฑ n) (Fin n) ฮฑ fun x x => True
instance
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} {n :
Nat: Type
Nat
} :
GetElem: (cont : Type ?u.8) โ†’ (idx : Type ?u.7) โ†’ outParam (Type ?u.6) โ†’ outParam (cont โ†’ idx โ†’ Prop) โ†’ Type (max(max?u.8?u.7)?u.6)
GetElem
(
Vector: Type ?u.9 โ†’ โ„• โ†’ Type ?u.9
Vector
ฮฑ: Type u
ฮฑ
n) (
Fin: โ„• โ†’ Type
Fin
n)
ฮฑ: Type u
ฮฑ
(fun
_: ?m.11
_
_: ?m.14
_
=>
True: Prop
True
) where getElem := fun
v: ?m.45
v
i: ?m.48
i
_: ?m.51
_
=>
v: ?m.45
v
.
1: {ฮฑ : Sort ?u.62} โ†’ {p : ฮฑ โ†’ Prop} โ†’ Subtype p โ†’ ฮฑ
1
[
i: ?m.48
i
.
val: {n : โ„•} โ†’ Fin n โ†’ โ„•
val
] @[simp] theorem
getElem_eq_get: โˆ€ {ฮฑ : Type u} {n : โ„•} (v : Vector ฮฑ n) (i : Fin n), v[i] = get v i
getElem_eq_get
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} {n :
Nat: Type
Nat
} (
v: Vector ฮฑ n
v
:
Vector: Type ?u.634 โ†’ โ„• โ†’ Type ?u.634
Vector
ฮฑ: Type u
ฮฑ
n) (
i: Fin n
i
:
Fin: โ„• โ†’ Type
Fin
n) :
v: Vector ฮฑ n
v
[
i: Fin n
i
] =
v: Vector ฮฑ n
v
.
get: {ฮฑ : Type ?u.689} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Fin n โ†’ ฮฑ
get
i: Fin n
i
:=
rfl: โˆ€ {ฮฑ : Sort ?u.817} {a : ฮฑ}, a = a
rfl
end Vector namespace Bitvec def
width: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
width
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.869
n
โ†’
Nat: Type
Nat
:= fun
_: ?m.877
_
=> n -- Shouldn't this be inferred from the instance above? (as Bitvec is @[reducible])
instance: {n : โ„•} โ†’ GetElem (Bitvec n) (Fin n) Bool fun x x => True
instance
{n :
Nat: Type
Nat
} :
GetElem: (cont : Type ?u.917) โ†’ (idx : Type ?u.916) โ†’ outParam (Type ?u.915) โ†’ outParam (cont โ†’ idx โ†’ Prop) โ†’ Type (max(max?u.917?u.916)?u.915)
GetElem
(
Bitvec: โ„• โ†’ Type
Bitvec
n) (
Fin: โ„• โ†’ Type
Fin
n)
Bool: Type
Bool
(fun
_: ?m.919
_
_: ?m.922
_
=>
True: Prop
True
) where getElem := fun
v: ?m.948
v
i: ?m.951
i
_: ?m.954
_
=>
v: ?m.948
v
.
1: {ฮฑ : Sort ?u.965} โ†’ {p : ฮฑ โ†’ Prop} โ†’ Subtype p โ†’ ฮฑ
1
[
i: ?m.951
i
.
val: {n : โ„•} โ†’ Fin n โ†’ โ„•
val
]
instance: (n : โ„•) โ†’ Inhabited (Bitvec n)
instance
(n :
Nat: Type
Nat
) :
Inhabited: Sort ?u.1488 โ†’ Sort (max1?u.1488)
Inhabited
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := โŸจ
List.replicate: {ฮฑ : Type ?u.1508} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n
true: Bool
true
,

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
โŸฉ def
Fun: (width : โ„•) โ†’ ?m.1584 width
Fun
(
width: โ„•
width
:
Nat: Type
Nat
) :=
Fin: โ„• โ†’ Type
Fin
width: โ„•
width
โ†’
Bool: Type
Bool
def
ofInt': (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
ofInt'
(n :
Nat: Type
Nat
) (z :
Int: Type
Int
) :
Bitvec: โ„• โ†’ Type
Bitvec
n := match n with | 0 => โŸจ
List.nil: {ฮฑ : Type ?u.1633} โ†’ List ฮฑ
List.nil
,
rfl: โˆ€ {ฮฑ : Sort ?u.1636} {a : ฮฑ}, a = a
rfl
โŸฉ | m + 1 =>
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec (Nat.succ n)
Bitvec.ofInt
m z /-- convert `Bitvec n` to `Fin n โ†’ Bool` -/ def
ofFun: {width : โ„•} โ†’ Fun width โ†’ Bitvec width
ofFun
{
width: โ„•
width
:
Nat: Type
Nat
} :
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
:=
Vector.ofFn: {ฮฑ : Type ?u.1904} โ†’ {n : โ„•} โ†’ (Fin n โ†’ ฮฑ) โ†’ Vector ฮฑ n
Vector.ofFn
/-- convert `Fin n โ†’ Bool` to `Bitvec n` -/ def
toFun: {width : โ„•} โ†’ Bitvec width โ†’ Fun width
toFun
{
width: โ„•
width
:
Nat: Type
Nat
} :
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
โ†’
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
:=
Vector.get: {ฮฑ : Type ?u.1958} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Fin n โ†’ ฮฑ
Vector.get
instance: {width : โ„•} โ†’ Coe (Fun width) (Bitvec width)
instance
{
width: โ„•
width
:
Nat: Type
Nat
} :
Coe: semiOutParam (Sort ?u.2016) โ†’ Sort ?u.2015 โ†’ Sort (max(max1?u.2016)?u.2015)
Coe
(
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
) (
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
) := โŸจ@
ofFun: {width : โ„•} โ†’ Fun width โ†’ Bitvec width
ofFun
width: โ„•
width
โŸฉ
instance: {width : โ„•} โ†’ Coe (Bitvec width) (Fun width)
instance
{
width: โ„•
width
:
Nat: Type
Nat
} :
Coe: semiOutParam (Sort ?u.2097) โ†’ Sort ?u.2096 โ†’ Sort (max(max1?u.2097)?u.2096)
Coe
(
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
) (
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
) := โŸจ@
toFun: {width : โ„•} โ†’ Bitvec width โ†’ Fun width
toFun
width: โ„•
width
โŸฉ def
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
:
Vector: Type ?u.2179 โ†’ โ„• โ†’ Type ?u.2179
Vector
Bool: Type
Bool
n: ?m.2175
n
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.2175
n
:=
id: {ฮฑ : Sort ?u.2185} โ†’ ฮฑ โ†’ ฮฑ
id
-- inspired by: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Defining.20my.20own.20numerals -- not ideal solution, as hard to type, but should be ok for now prefix:max "๐Ÿถ" => fun v =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
false: Bool
false
v) prefix:max "๐Ÿท" => fun v =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
true: Bool
true
v) notation:max "๐Ÿถ" =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
false: Bool
false
(@
Vector.nil: {ฮฑ : Type u} โ†’ Vector ฮฑ 0
Vector.nil
Bool: Type
Bool
)) notation:max "๐Ÿท" =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
true: Bool
true
(@
Vector.nil: {ฮฑ : Type u} โ†’ Vector ฮฑ 0
Vector.nil
Bool: Type
Bool
))
instance: {n : โ„•} โ†’ Add (Bitvec n)
instance
:
Add: Type ?u.125046 โ†’ Type ?u.125046
Add
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.125043
n
) where add :=
Bitvec.add: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.add
instance: {n : โ„•} โ†’ Sub (Bitvec n)
instance
:
Sub: Type ?u.125140 โ†’ Type ?u.125140
Sub
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.125137
n
) where sub :=
Bitvec.sub: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.sub
-- examples: -- #eval (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat -- #eval (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท).toNat -- #eval (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) + (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.toNat -- #eval ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท + ๐Ÿถ๐Ÿท๐Ÿท๐Ÿท -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) true -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) false -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) true |>.toNat -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) false |>.toNat -- -- #eval Bitvec.adc (๐Ÿถ) (๐Ÿถ) true -- #eval Bitvec.adc (๐Ÿถ) (๐Ÿถ) false def
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.125237
2
^ n) :=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
theorem
toZMod_val: โˆ€ {n : โ„•} (v : Bitvec n), ZMod.val (toZMod v) = Bitvec.toNat v
toZMod_val
{n :
โ„•: Type
โ„•
} (
v: Bitvec n
v
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
v: Bitvec n
v
).
val: {n : โ„•} โ†’ ZMod n โ†’ โ„•
val
=
v: Bitvec n
v
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
def
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
{n :
โ„•: Type
โ„•
} (
x: ZMod (2 ^ n)
x
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.125994
2
^ n)) :
Bitvec: โ„• โ†’ Type
Bitvec
n :=
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
_
x: ZMod (2 ^ n)
x
.
val: {n : โ„•} โ†’ ZMod n โ†’ โ„•
val
theorem
toZMod_ofZMod: โˆ€ {n : โ„•} (i : ZMod (2 ^ n)), toZMod (ofZMod i) = i
toZMod_ofZMod
{n} (
i: ZMod (2 ^ n)
i
:
ZMod: โ„• โ†’ Type
ZMod
<|
2: ?m.126158
2
^
n: ?m.126151
n
) : (
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
i: ZMod (2 ^ n)
i
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
i: ZMod (2 ^ n)
i
:=
ZMod.val_injective: โˆ€ (n : โ„•) [inst : NeZero n], Function.Injective ZMod.val
ZMod.val_injective
_ (

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
) theorem
ofZMod_toZMod: โˆ€ {n : โ„•} (v : Bitvec n), ofZMod (toZMod v) = v
ofZMod_toZMod
{n} (
v: Bitvec n
v
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.126550
n
) :
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
(
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
v: Bitvec n
v
) =
v: Bitvec n
v
:=

Goals accomplished! ๐Ÿ™

v = v

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_add: โˆ€ (n k : โ„•) (x : List Bool), List.foldl addLsb (n + k) x = 2 ^ List.length x * k + List.foldl addLsb n x
foldl_addLsb_add
: โˆ€ (n k :
โ„•: Type
โ„•
) (x :
List: Type ?u.126633 โ†’ Type ?u.126633
List
Bool: Type
Bool
), x.
foldl: {ฮฑ : Type ?u.126638} โ†’ {ฮฒ : Type ?u.126637} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(n + k) =
2: ?m.126703
2
^ x.
length: {ฮฑ : Type ?u.126712} โ†’ List ฮฑ โ†’ โ„•
length
* k + x.
foldl: {ฮฑ : Type ?u.126717} โ†’ {ฮฒ : Type ?u.126716} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
n | n, k, [] =>

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
| n, k,
a: Bool
a
::l =>

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (addLsb (n + k) a) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (addLsb (n + k) a) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (addLsb n a) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (addLsb n a) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


(n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb ((n + n + bif a then 1 else 0) + (k + k)) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


2 ^ List.length l * (k + k) + List.foldl addLsb (n + n + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


2 ^ List.length l * (k + k) + List.foldl addLsb (n + n + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_eq_add_foldl_addLsb_zero: โˆ€ (x : List Bool) (k : โ„•), List.foldl addLsb k x = 2 ^ List.length x * k + List.foldl addLsb 0 x
foldl_addLsb_eq_add_foldl_addLsb_zero
(x :
List: Type ?u.129331 โ†’ Type ?u.129331
List
Bool: Type
Bool
) (k :
โ„•: Type
โ„•
) : x.
foldl: {ฮฑ : Type ?u.129338} โ†’ {ฮฒ : Type ?u.129337} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
k =
2: ?m.129363
2
^ x.
length: {ฮฑ : Type ?u.129372} โ†’ List ฮฑ โ†’ โ„•
length
* k + x.
foldl: {ฮฑ : Type ?u.129377} โ†’ {ฮฒ : Type ?u.129376} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129392
0
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_cons_zero: โˆ€ (a : Bool) (x : List Bool), List.foldl addLsb 0 (a :: x) = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x
foldl_addLsb_cons_zero
(
a: Bool
a
:
Bool: Type
Bool
) (x :
List: Type ?u.129684 โ†’ Type ?u.129684
List
Bool: Type
Bool
) : (
a: Bool
a
::x).
foldl: {ฮฑ : Type ?u.129692} โ†’ {ฮฒ : Type ?u.129691} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129707
0
=
2: ?m.129727
2
^x.
length: {ฮฑ : Type ?u.129736} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.129740} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
a: Bool
a
1: ?m.129743
1
0: ?m.129753
0
+ x.
foldl: {ฮฑ : Type ?u.129761} โ†’ {ฮฒ : Type ?u.129760} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129776
0
:= calc (
a: Bool
a
::x).
foldl: {ฮฑ : Type ?u.129929} โ†’ {ฮฒ : Type ?u.129928} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129944
0
= x.
foldl: {ฮฑ : Type ?u.129947} โ†’ {ฮฒ : Type ?u.129946} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
0: ?m.129968
0
+
0: ?m.129979
0
+
cond: {ฮฑ : Type ?u.129989} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
a: Bool
a
1: ?m.129992
1
0: ?m.130002
0
) :=
rfl: โˆ€ {ฮฑ : Sort ?u.130072} {a : ฮฑ}, a = a
rfl
_: ?mโœ
_
=
_: ?m.130127
_
:=

Goals accomplished! ๐Ÿ™

List.foldl addLsb (0 + 0 + bif a then 1 else 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

List.foldl addLsb (0 + 0 + bif a then 1 else 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

(2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb (0 + 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

Goals accomplished! ๐Ÿ™
theorem
toNat_adc_aux: โˆ€ {x y : List Bool}, List.length x = List.length y โ†’ List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd = List.foldl addLsb 0 x + List.foldl addLsb 0 y
toNat_adc_aux
: โˆ€ {x y:
List: Type ?u.130233 โ†’ Type ?u.130233
List
Bool: Type
Bool
} (_h :
List.length: {ฮฑ : Type ?u.130240} โ†’ List ฮฑ โ†’ โ„•
List.length
x =
List.length: {ฮฑ : Type ?u.130244} โ†’ List ฮฑ โ†’ โ„•
List.length
y),
List.foldl: {ฮฑ : Type ?u.130252} โ†’ {ฮฒ : Type ?u.130251} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130262
0
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.130275} โ†’ {ฯƒ : Type ?u.130274} โ†’ {ฮฑ : Type ?u.130273} โ†’ {ฮฒ : Type ?u.130272} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.130281
x
y: ?m.130284
y
c: ?m.130287
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
x: ?m.130281
x
y: ?m.130284
y
c: ?m.130287
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.130281
x
y: ?m.130284
y
c: ?m.130287
c
)) x y
false: Bool
false
).
fst: {ฮฑ : Type ?u.130306} โ†’ {ฮฒ : Type ?u.130305} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
) (
List.mapAccumrโ‚‚: {ฯ† : Type ?u.130312} โ†’ {ฯƒ : Type ?u.130311} โ†’ {ฮฑ : Type ?u.130310} โ†’ {ฮฒ : Type ?u.130309} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.130318
x
y: ?m.130321
y
c: ?m.130324
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
x: ?m.130318
x
y: ?m.130321
y
c: ?m.130324
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.130318
x
y: ?m.130321
y
c: ?m.130324
c
)) x y
false: Bool
false
).
snd: {ฮฑ : Type ?u.130341} โ†’ {ฮฒ : Type ?u.130340} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
=
List.foldl: {ฮฑ : Type ?u.130348} โ†’ {ฮฒ : Type ?u.130347} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130358
0
x +
List.foldl: {ฮฑ : Type ?u.130361} โ†’ {ฮฒ : Type ?u.130360} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130371
0
y | [], [], _ =>
rfl: โˆ€ {ฮฑ : Sort ?u.130456} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x,
b: Bool
b
::y,
h: List.length (a :: x) = List.length (b :: y)
h
=>

Goals accomplished! ๐Ÿ™

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x + ((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (List.foldl addLsb 0 x + List.foldl addLsb 0 y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst) (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst) (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

false
2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && b || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true
2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && b || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false
2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && b || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true
2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && b || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.false
2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && false || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.true
2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && true || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.false
2 ^ List.length (xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && false || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true
2 ^ List.length (xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && true || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.false
2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && false || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.true
2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && true || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

Goals accomplished! ๐Ÿ™

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true
(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false
(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.false.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

false.true.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

Goals accomplished! ๐Ÿ™
theorem
toNat_adc: โˆ€ {n : โ„•} {x y : Bitvec n}, Bitvec.toNat (adc x y false) = Bitvec.toNat x + Bitvec.toNat y
toNat_adc
{n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n} : (
Bitvec.adc: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bitvec (n + 1)
Bitvec.adc
x: Bitvec n
x
y: Bitvec n
y
false: Bool
false
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
+
y: Bitvec n
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
:=

Goals accomplished! ๐Ÿ™

mk
Bitvec.toNat (adc { val := x, property := hx } y false) = Bitvec.toNat { val := x, property := hx } + Bitvec.toNat y

mk.mk
Bitvec.toNat (adc { val := x, property := hx } { val := y, property := hy } false) = Bitvec.toNat { val := x, property := hx } + Bitvec.toNat { val := y, property := hy }

mk.mk
Bitvec.toNat (adc { val := x, property := (_ : List.length x = List.length x) } { val := y, property := hy } false) = Bitvec.toNat { val := x, property := (_ : List.length x = List.length x) } + Bitvec.toNat { val := y, property := hy }

mk.mk
List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd = List.foldl addLsb 0 x + List.foldl addLsb 0 y

Goals accomplished! ๐Ÿ™
theorem
toNat_tail: โˆ€ {n : โ„•} (x : Bitvec n), Bitvec.toNat (Vector.tail x) = Bitvec.toNat x % 2 ^ (n - 1)
toNat_tail
: โˆ€ {n :
Nat: Type
Nat
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n),
Bitvec.toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
Bitvec.toNat
x: Bitvec n
x
.
tail: {ฮฑ : Type ?u.143473} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (n - 1)
tail
=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
%
2: ?m.143492
2
^(n-
1: ?m.143505
1
) | 0, โŸจ[], _โŸฉ =>
rfl: โˆ€ {ฮฑ : Sort ?u.143701} {a : ฮฑ}, a = a
rfl
| n+1, โŸจ
a: Bool
a
::l,
h: List.length (a :: l) = n + 1
h
โŸฉ =>

Goals accomplished! ๐Ÿ™
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h })
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


Bitvec.toNat (Vector.tail { val := a :: l, property := hโœ }) % 2 ^ (n + 1 - 1) = Bitvec.toNat { val := a :: l, property := hโœ } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 โ†‘(Vector.tail { val := a :: l, property := hโœ }) % 2 ^ (n + 1 - 1) = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((bif a then 1 else 0) * 2 ^ n + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n



Goals accomplished! ๐Ÿ™
@[simp] theorem
toNat_add: โˆ€ {n : โ„•} (x y : Bitvec n), Bitvec.toNat (x + y) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n
toNat_add
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
+
y: Bitvec n
y
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
= (
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
+
y: Bitvec n
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) %
2: ?m.146225
2
^n :=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


Bitvec.toNat (adc x y false) % 2 ^ (n + 1 - 1) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n
n: โ„•

x, y: Bitvec n


(Bitvec.toNat x + Bitvec.toNat y) % 2 ^ (n + 1 - 1) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n

Goals accomplished! ๐Ÿ™
theorem
toZMod_add: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x + y) = toZMod x + toZMod y
toZMod_add
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
+
y: Bitvec n
y
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= (
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
+
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
) :=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (x + y) = toZMod x + toZMod y
n: โ„•

x, y: Bitvec n


toZMod (x + y) = toZMod x + toZMod y
n: โ„•

x, y: Bitvec n


a
n: โ„•

x, y: Bitvec n


a

Goals accomplished! ๐Ÿ™
theorem
ofZMod_add: โˆ€ {n : โ„•} (x y : ZMod (2 ^ n)), ofZMod (x + y) = ofZMod x + ofZMod y
ofZMod_add
{n :
โ„•: Type
โ„•
} (
x: ZMod (2 ^ n)
x
y: ZMod (2 ^ n)
y
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.147846
2
^n)) :
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
x: ZMod (2 ^ n)
x
+
y: ZMod (2 ^ n)
y
) =
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
x: ZMod (2 ^ n)
x
+
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
y: ZMod (2 ^ n)
y
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)



Goals accomplished! ๐Ÿ™
theorem
zero_def: โˆ€ {n : โ„•}, 0 = { val := List.replicate n false, property := (_ : List.length โ†‘0 = n) }
zero_def
: (
0: ?m.148270
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148264
n
) = โŸจ
List.replicate: {ฮฑ : Type ?u.148313} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n: ?m.148264
n
false: Bool
false
, (
0: ?m.148318
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148264
n
).
2: โˆ€ {ฮฑ : Sort ?u.148320} {p : ฮฑ โ†’ Prop} (self : Subtype p), p โ†‘self
2
โŸฉ :=
rfl: โˆ€ {ฮฑ : Sort ?u.148341} {a : ฮฑ}, a = a
rfl
theorem
toList_zero: โˆ€ {n : โ„•}, Vector.toList 0 = List.replicate n false
toList_zero
:
Vector.toList: {ฮฑ : Type ?u.148361} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
Vector.toList
(
0: ?m.148366
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148357
n
) =
List.replicate: {ฮฑ : Type ?u.148395} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n: ?m.148357
n
false: Bool
false
:=
rfl: โˆ€ {ฮฑ : Sort ?u.148401} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toNat_zero: โˆ€ {n : โ„•}, Bitvec.toNat 0 = 0
toNat_zero
: โˆ€ {n :
Nat: Type
Nat
}, (
0: ?m.148433
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
0: ?m.148465
0
| 0 =>
rfl: โˆ€ {ฮฑ : Sort ?u.148496} {a : ฮฑ}, a = a
rfl
| n+1 =>

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
ofNat_zero: โˆ€ {w : โ„•}, Bitvec.ofNat w 0 = 0
ofNat_zero
:
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.149369
w
0: ?m.149374
0
=
0: ?m.149385
0
:=

Goals accomplished! ๐Ÿ™

0 = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
toZMod_zero: โˆ€ {n : โ„•}, toZMod 0 = 0
toZMod_zero
: โˆ€ {n :
Nat: Type
Nat
}, (
0: ?m.149459
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
0: ?m.149507
0
:=

Goals accomplished! ๐Ÿ™

โˆ€ {n : โ„•}, toZMod 0 = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
ofZMod_zero: โˆ€ {n : โ„•}, ofZMod 0 = 0
ofZMod_zero
:
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
0: ?m.151433
0
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.151361
2
^
n: ?m.151351
n
)) =
0: ?m.151736
0
:=

Goals accomplished! ๐Ÿ™

0 = 0

Goals accomplished! ๐Ÿ™
theorem
toList_one: โˆ€ {n : โ„•}, Vector.toList 1 = List.replicate n false ++ [true]
toList_one
{n :
โ„•: Type
โ„•
} : (
1: ?m.151914
1
:
Bitvec: โ„• โ†’ Type
Bitvec
(n +
1: ?m.151853
1
)).
toList: {ฮฑ : Type ?u.151938} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
=
List.replicate: {ฮฑ : Type ?u.151949} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n
false: Bool
false
++ [
true: Bool
true
] :=
rfl: โˆ€ {ฮฑ : Sort ?u.151995} {a : ฮฑ}, a = a
rfl
theorem
toNat_one: โˆ€ {n : โ„•}, Bitvec.toNat 1 = if n = 0 then 0 else 1
toNat_one
: โˆ€ {n :
Nat: Type
Nat
}, (
1: ?m.152071
1
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
= if n =
0: ?m.152104
0
then
0: ?m.152129
0
else
1: ?m.152140
1
| 0 =>
rfl: โˆ€ {ฮฑ : Sort ?u.152183} {a : ฮฑ}, a = a
rfl
| 1 =>
rfl: โˆ€ {ฮฑ : Sort ?u.152234} {a : ฮฑ}, a = a
rfl
| n+2 =>

Goals accomplished! ๐Ÿ™

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1
n: โ„•

this: Bitvec.toNat 1 = if n + 1 = 0 then 0 else 1


Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Goals accomplished! ๐Ÿ™
@[simp] theorem
toZMod_one: โˆ€ {n : โ„•}, toZMod 1 = 1
toZMod_one
: โˆ€ {n :
Nat: Type
Nat
}, (
1: ?m.155230
1
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
1: ?m.155278
1
:=

Goals accomplished! ๐Ÿ™

โˆ€ {n : โ„•}, toZMod 1 = 1

Goals accomplished! ๐Ÿ™
@[simp] theorem
ofZMod_one: โˆ€ {n : โ„•}, ofZMod 1 = 1
ofZMod_one
:
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
1: ?m.159402
1
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.159330
2
^
n: ?m.159320
n
)) =
1: ?m.159615
1
:=

Goals accomplished! ๐Ÿ™

1 = 1

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ SMul โ„• (Bitvec n)
instance
:
SMul: Type ?u.159731 โ†’ Type ?u.159730 โ†’ Type (max?u.159731?u.159730)
SMul
โ„•: Type
โ„•
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.159727
n
) := โŸจ
nsmulRec: {M : Type ?u.159743} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ โ„• โ†’ M โ†’ M
nsmulRec
โŸฉ theorem
nsmul_def: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), y โ€ข x = nsmulRec y x
nsmul_def
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„•: Type
โ„•
) : y โ€ข
x: Bitvec n
x
=
nsmulRec: {M : Type ?u.160058} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ โ„• โ†’ M โ†’ M
nsmulRec
y
x: Bitvec n
x
:=
rfl: โˆ€ {ฮฑ : Sort ?u.160090} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toZMod_nsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_nsmul
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„•: Type
โ„•
) : (y โ€ข
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= y โ€ข
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_sub_aux: โˆ€ {x y : List Bool}, List.length x = List.length y โ†’ (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y)
toInt_sub_aux
: โˆ€ {x y :
List: Type ?u.164902 โ†’ Type ?u.164902
List
Bool: Type
Bool
} (_hx :
List.length: {ฮฑ : Type ?u.164909} โ†’ List ฮฑ โ†’ โ„•
List.length
x =
List.length: {ฮฑ : Type ?u.164913} โ†’ List ฮฑ โ†’ โ„•
List.length
y), (โ†‘(
List.foldl: {ฮฑ : Type ?u.164925} โ†’ {ฮฒ : Type ?u.164924} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.164935
0
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.164948} โ†’ {ฯƒ : Type ?u.164947} โ†’ {ฮฑ : Type ?u.164946} โ†’ {ฮฒ : Type ?u.164945} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.164954
x
y: ?m.164957
y
c: ?m.164960
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
(!
x: ?m.164954
x
)
y: ?m.164957
y
c: ?m.164960
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.164954
x
y: ?m.164957
y
c: ?m.164960
c
)) x y
false: Bool
false
).
snd: {ฮฑ : Type ?u.164979} โ†’ {ฮฒ : Type ?u.164978} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
) :
โ„ค: Type
โ„ค
) -
2: ?m.165039
2
^ x.
length: {ฮฑ : Type ?u.165048} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.165052} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.165057} โ†’ {ฯƒ : Type ?u.165056} โ†’ {ฮฑ : Type ?u.165055} โ†’ {ฮฒ : Type ?u.165054} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.165063
x
y: ?m.165066
y
c: ?m.165069
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
(!
x: ?m.165063
x
)
y: ?m.165066
y
c: ?m.165069
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.165063
x
y: ?m.165066
y
c: ?m.165069
c
)) x y
false: Bool
false
).
fst: {ฮฑ : Type ?u.165086} โ†’ {ฮฒ : Type ?u.165085} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
1: ?m.165090
1
0: ?m.165100
0
= โ†‘(
List.foldl: {ฮฑ : Type ?u.165444} โ†’ {ฮฒ : Type ?u.165443} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.165454
0
x) + -โ†‘(
List.foldl: {ฮฑ : Type ?u.165488} โ†’ {ฮฒ : Type ?u.165487} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.165498
0
y) | [], [], _ =>
rfl: โˆ€ {ฮฑ : Sort ?u.165916} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x,
b: Bool
b
::y,
h: List.length (a :: x) = List.length (b :: y)
h
=>

Goals accomplished! ๐Ÿ™

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x) + -โ†‘((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + -โ†‘((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + -(โ†‘(2 ^ List.length y * bif b then 1 else 0) + โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + (-โ†‘(2 ^ List.length y * bif b then 1 else 0) + -โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd) - 2 ^ List.length (a :: x) * bif (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd) - 2 ^ List.length (a :: x) * bif (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

false
(โ†‘(2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && b || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true
(โ†‘(2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && b || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false
(โ†‘(2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && b || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true
(โ†‘(2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && b || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
(โ†‘(2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && false || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true
(โ†‘(2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && true || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
(โ†‘(2 ^ List.length (xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && false || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.true
(โ†‘(2 ^ List.length (xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && true || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
(โ†‘(2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && false || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true
(โ†‘(2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && true || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + 2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)

false.true
-(2 ^ List.length y + 2 ^ List.length y) + (โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd)) = -โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

true.false
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

true.true
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + 2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)) = โ†‘2 ^ List.length y + (-โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)))

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y

false.true
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

true.false
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.true
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

true.true.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

false.false.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

false.true.false
โ†‘(bif false then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif false then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

false.true.true
โ†‘(bif true then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif true then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

true.false.false
โ†‘(bif false then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.false.true
โ†‘(bif true then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.true.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

true.true.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true.true
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false.true
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y

false.true.false
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -2 ^ List.length y

false.true.true
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2 = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-2 ^ List.length y - 2 ^ List.length y)

true.false.false
2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + 2 ^ List.length y

true.true.true
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

Goals accomplished! ๐Ÿ™
instance: โˆ€ (n : โ„•), NeZero (2 ^ n)
instance
(n :
โ„•: Type
โ„•
) :
NeZero: {R : Type ?u.190440} โ†’ [inst : Zero R] โ†’ R โ†’ Prop
NeZero
(
2: ?m.190522
2
^ n) := โŸจ
Nat.pos_iff_ne_zero: โˆ€ {n : โ„•}, 0 < n โ†” n โ‰  0
Nat.pos_iff_ne_zero
.
1: โˆ€ {a b : Prop}, (a โ†” b) โ†’ a โ†’ b
1
<|
pow_pos: โˆ€ {ฮฑ : Type ?u.190698} [inst : StrictOrderedSemiring ฮฑ] {a : ฮฑ}, 0 < a โ†’ โˆ€ (n : โ„•), 0 < a ^ n
pow_pos
(

Goals accomplished! ๐Ÿ™

0 < 2

Goals accomplished! ๐Ÿ™
) _โŸฉ theorem
toZMod_sbb: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (sbb x y false).snd = toZMod x - toZMod y
toZMod_sbb
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
.
sbb: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bool ร— Bitvec n
sbb
y: Bitvec n
y
false: Bool
false
).
2: {ฮฑ : Type ?u.190815} โ†’ {ฮฒ : Type ?u.190814} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
2
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
-
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk
toZMod (sbb { val := x, property := hx } y false).snd = toZMod { val := x, property := hx } - toZMod y
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
toZMod (sbb { val := x, property := hx } { val := y, property := hy } false).snd = toZMod { val := x, property := hx } - toZMod { val := y, property := hy }
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)

Goals accomplished! ๐Ÿ™

2 ^ n = 0

2 ^ n = 0

โ†‘2 ^ n = 0

2 ^ n = 0

โ†‘(2 ^ n) = 0

2 ^ n = 0

0 = 0

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y
n: โ„•

x: List Bool

hx: List.length x = n

y: List Bool

hy: List.length y = n

h2n: 2 ^ n = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0) = โ†‘(โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y))


mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

Goals accomplished! ๐Ÿ™
theorem
toZMod_sub: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x - y) = toZMod x - toZMod y
toZMod_sub
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
-
y: Bitvec n
y
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
-
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=
toZMod_sbb: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (sbb x y false).snd = toZMod x - toZMod y
toZMod_sbb
x: Bitvec n
x
y: Bitvec n
y
theorem
toInt_neg_aux: โˆ€ (x : List Bool), (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 x)
toInt_neg_aux
: โˆ€ (x :
List: Type ?u.199365 โ†’ Type ?u.199365
List
Bool: Type
Bool
), ((
List.foldl: {ฮฑ : Type ?u.199375} โ†’ {ฮฒ : Type ?u.199374} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
0: ?m.199386
0
:
โ„•: Type
โ„•
) (
List.mapAccumr: {ฯƒ : Type ?u.199398} โ†’ {ฮฑ : Type ?u.199397} โ†’ {ฮฒ : Type ?u.199396} โ†’ (ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— ฮฒ) โ†’ List ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— List ฮฒ
List.mapAccumr
(fun
y: ?m.199403
y
c: ?m.199406
c
=> (
y: ?m.199403
y
||
c: ?m.199406
c
,
xor: Bool โ†’ Bool โ†’ Bool
xor
y: ?m.199403
y
c: ?m.199406
c
)) x
false: Bool
false
).
snd: {ฮฑ : Type ?u.199424} โ†’ {ฮฒ : Type ?u.199423} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
:
โ„•: Type
โ„•
) -
2: ?m.199434
2
^ x.
length: {ฮฑ : Type ?u.199443} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.199447} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
(
List.mapAccumr: {ฯƒ : Type ?u.199451} โ†’ {ฮฑ : Type ?u.199450} โ†’ {ฮฒ : Type ?u.199449} โ†’ (ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— ฮฒ) โ†’ List ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— List ฮฒ
List.mapAccumr
(fun
y: ?m.199456
y
c: ?m.199459
c
=> (
y: ?m.199456
y
||
c: ?m.199459
c
,
xor: Bool โ†’ Bool โ†’ Bool
xor
y: ?m.199456
y
c: ?m.199459
c
)) x
false: Bool
false
).
fst: {ฮฑ : Type ?u.199474} โ†’ {ฮฒ : Type ?u.199473} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
1: ?m.199478
1
0: ?m.199488
0
:
โ„ค: Type
โ„ค
) = -(
List.foldl: {ฮฑ : Type ?u.199881} โ†’ {ฮฒ : Type ?u.199880} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.199891
0
x) | [] =>
rfl: โˆ€ {ฮฑ : Sort ?u.200249} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x =>

Goals accomplished! ๐Ÿ™

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘((2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘((2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

false
(2 ^ List.length x * โ†‘(bif xor false (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true
(2 ^ List.length x * โ†‘(bif xor true (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false
(2 ^ List.length x * โ†‘(bif xor false (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true
(2 ^ List.length x * โ†‘(bif xor true (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true.false
(2 ^ List.length x * โ†‘(bif xor true false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

true.true
(2 ^ List.length x * โ†‘(bif xor true true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false.false
(2 ^ List.length x * โ†‘(bif xor false false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

false.true
(2 ^ List.length x * โ†‘(bif xor false true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

true.false
(2 ^ List.length x * โ†‘(bif xor true false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

true.true
(2 ^ List.length x * โ†‘(bif xor true true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true.true
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + -2 ^ List.length x)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false.true
2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + -2 ^ List.length x

true.false
2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)

true.true
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + -2 ^ List.length x)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

Goals accomplished! ๐Ÿ™
theorem
toZMod_neg: โˆ€ {n : โ„•} (x : Bitvec n), toZMod (-x) = -toZMod x
toZMod_neg
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (-
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= -
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

mk
toZMod (Bitvec.neg { val := x, property := hx }) = -toZMod { val := x, property := hx }

mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

Goals accomplished! ๐Ÿ™

2 ^ n = 0

2 ^ n = 0

โ†‘2 ^ n = 0

2 ^ n = 0

โ†‘(2 ^ n) = 0

2 ^ n = 0

0 = 0

Goals accomplished! ๐Ÿ™
n: โ„•

x: List Bool

hx: List.length x = n

h2n: 2 ^ n = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = โ†‘(-โ†‘(List.foldl addLsb 0 x))


mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)
x: List Bool

h2n: 2 ^ List.length x = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = โ†‘(-โ†‘(List.foldl addLsb 0 x))


mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ SMul โ„ค (Bitvec n)
instance
:
SMul: Type ?u.225481 โ†’ Type ?u.225480 โ†’ Type (max?u.225481?u.225480)
SMul
โ„ค: Type
โ„ค
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.225477
n
) := โŸจ
zsmulRec: {M : Type ?u.225493} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ [inst : Neg M] โ†’ โ„ค โ†’ M โ†’ M
zsmulRec
โŸฉ theorem
zsmul_def: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), y โ€ข x = zsmulRec y x
zsmul_def
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„ค: Type
โ„ค
) : y โ€ข
x: Bitvec n
x
=
zsmulRec: {M : Type ?u.225880} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ [inst : Neg M] โ†’ โ„ค โ†’ M โ†’ M
zsmulRec
y
x: Bitvec n
x
:=
rfl: โˆ€ {ฮฑ : Sort ?u.225923} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toZMod_zsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_zsmul
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„ค: Type
โ„ค
) : (y โ€ข
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= y โ€ข
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ AddCommGroup (Bitvec n)
instance
:
AddCommGroup: Type ?u.230846 โ†’ Type ?u.230846
AddCommGroup
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.230843
n
) :=
Function.Injective.addCommGroup: {Mโ‚ : Type ?u.230850} โ†’ {Mโ‚‚ : Type ?u.230849} โ†’ [inst : Add Mโ‚] โ†’ [inst_1 : Zero Mโ‚] โ†’ [inst_2 : SMul โ„• Mโ‚] โ†’ [inst_3 : Neg Mโ‚] โ†’ [inst_4 : Sub Mโ‚] โ†’ [inst_5 : SMul โ„ค Mโ‚] โ†’ [inst_6 : AddCommGroup Mโ‚‚] โ†’ (f : Mโ‚ โ†’ Mโ‚‚) โ†’ Function.Injective f โ†’ f 0 = 0 โ†’ (โˆ€ (x y : Mโ‚), f (x + y) = f x + f y) โ†’ (โˆ€ (x : Mโ‚), f (-x) = -f x) โ†’ (โˆ€ (x y : Mโ‚), f (x - y) = f x - f y) โ†’ (โˆ€ (x : Mโ‚) (n : โ„•), f (n โ€ข x) = n โ€ข f x) โ†’ (โˆ€ (x : Mโ‚) (n : โ„ค), f (n โ€ข x) = n โ€ข f x) โ†’ AddCommGroup Mโ‚
Function.Injective.addCommGroup
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
(
Function.injective_iff_hasLeftInverse: โˆ€ {ฮฑ : Sort ?u.231282} {ฮฒ : Sort ?u.231283} [inst : Nonempty ฮฑ] {f : ฮฑ โ†’ ฮฒ}, Function.Injective f โ†” Function.HasLeftInverse f
Function.injective_iff_hasLeftInverse
.
2: โˆ€ {a b : Prop}, (a โ†” b) โ†’ b โ†’ a
2
โŸจ
_: ?m.231348
_
,
ofZMod_toZMod: โˆ€ {n : โ„•} (v : Bitvec n), ofZMod (toZMod v) = v
ofZMod_toZMod
โŸฉ)
toZMod_zero: โˆ€ {n : โ„•}, toZMod 0 = 0
toZMod_zero
toZMod_add: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x + y) = toZMod x + toZMod y
toZMod_add
toZMod_neg: โˆ€ {n : โ„•} (x : Bitvec n), toZMod (-x) = -toZMod x
toZMod_neg
toZMod_sub: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x - y) = toZMod x - toZMod y
toZMod_sub
toZMod_nsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_nsmul
toZMod_zsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_zsmul
-- see https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Pattern.20matching.20subtypes def
add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
add?
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
Option: Type ?u.232586 โ†’ Type ?u.232586
Option
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := match
Bitvec.adc: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bitvec (n + 1)
Bitvec.adc
x: Bitvec n
x
y: Bitvec n
y
false: Bool
false
with | โŸจ
false: Bool
false
:: z,
hcons: List.length (false :: z) = n + 1
hcons
โŸฉ =>
some: {ฮฑ : Type ?u.232636} โ†’ ฮฑ โ†’ Option ฮฑ
some
โŸจz,

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n

z: List Bool

hcons: List.length (false :: z) = n + 1



Goals accomplished! ๐Ÿ™
โŸฉ | _ =>
none: {ฮฑ : Type ?u.232657} โ†’ Option ฮฑ
none
-- overflow theorem
Warning: declaration uses 'sorry'
{n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
z: Bitvec n
z
:
Bitvec: โ„• โ†’ Type
Bitvec
n} :
add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
add?
x: Bitvec n
x
y: Bitvec n
y
=
some: {ฮฑ : Type ?u.233476} โ†’ ฮฑ โ†’ Option ฮฑ
some
z: Bitvec n
z
โ†’
x: Bitvec n
x
+
y: Bitvec n
y
=
z: Bitvec n
z
:=
sorry: ?m.233532
sorry
/- #eval (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat * (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat #eval Bitvec.mul (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.toNat -/ protected def
mul?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
mul?
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
Option: Type ?u.233547 โ†’ Type ?u.233547
Option
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := do let
f: (r : ?m.233571) โ†’ (b : ?m.233579 r) โ†’ ?m.233580 r b
f
r: ?m.233571
r
b: ?m.233574
b
:= do let
opโ‚: ?m.233736
opโ‚
โ†
Bitvec.add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.add?
r: ?m.233571
r
r: ?m.233571
r
let
opโ‚‚: ?m.233784
opโ‚‚
โ†
Bitvec.add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.add?
opโ‚: ?m.233736
opโ‚
y: Bitvec n
y
return
cond: {ฮฑ : Type ?u.233804} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
b: ?m.233574
b
opโ‚‚: ?m.233784
opโ‚‚
opโ‚: ?m.233736
opโ‚
(
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.233583} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
).
foldlM: {m : Type ?u.233593 โ†’ Type ?u.233592} โ†’ [inst : Monad m] โ†’ {s : Type ?u.233593} โ†’ {ฮฑ : Type ?u.233591} โ†’ (s โ†’ ฮฑ โ†’ m s) โ†’ s โ†’ List ฮฑ โ†’ m s
foldlM
f: (r : ?m.233571) โ†’ (b : ?m.233579 r) โ†’ ?m.233580 r b
f
0: ?m.233650
0
/- #eval Bitvec.mul? (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) #eval Bitvec.mul? (๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.get!|>.toNat -/ theorem
Warning: declaration uses 'sorry'
: โˆ€ {n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
z: Bitvec n
z
:
Bitvec: โ„• โ†’ Type
Bitvec
n},
Bitvec.mul?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.mul?
x: Bitvec n
x
y: Bitvec n
y
=
some: {ฮฑ : Type ?u.234279} โ†’ ฮฑ โ†’ Option ฮฑ
some
z: Bitvec n
z
โ†’
x: Bitvec n
x
*
y: Bitvec n
y
=
z: Bitvec n
z
:=
sorry: ?m.234343
sorry
/-- The value produced is the unsigned integer quotient of the two operands. Note that unsigned integer division and signed integer division are distinct operations; for signed integer division, use โ€˜sdivโ€™. Division by zero is undefined behavior. -/ def
udiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
udiv?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.234362 โ†’ Type ?u.234362
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := match
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
with | 0 =>
none: {ฮฑ : Type ?u.234389} โ†’ Option ฮฑ
none
| _ =>
some: {ฮฑ : Type ?u.234399} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w (
x: Bitvec w
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
/
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) /-- The value produced is the signed integer quotient of the two operands rounded towards zero. Note that signed integer division and unsigned integer division are distinct operations; for unsigned integer division, use โ€˜udivโ€™. Division by zero is undefined behavior. Overflow also leads to undefined behavior; this is a rare case, but can occur, for example, by doing a 32-bit division of -2147483648 by -1. -/ def
sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
sdiv?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.234723 โ†’ Type ?u.234723
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := if
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.234734
0
then
none: {ฮฑ : Type ?u.234772} โ†’ Option ฮฑ
none
else
some: {ฮฑ : Type ?u.234775} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofInt': (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt'
w (
x: Bitvec w
x
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
/
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
) /-- If the condition is an i1 and it evaluates to 1, the instruction returns the first value argument; otherwise, it returns the second value argument. -/ def
select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
select
{w :
Nat: Type
Nat
} (
c: Bitvec 1
c
:
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.234951
1
) (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Bitvec: โ„• โ†’ Type
Bitvec
w :=
cond: {ฮฑ : Type ?u.234976} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
c: Bitvec 1
c
.
head: {ฮฑ : Type ?u.234978} โ†’ {n : โ„•} โ†’ Vector ฮฑ (Nat.succ n) โ†’ ฮฑ
head
x: Bitvec w
x
y: Bitvec w
y
theorem
bitwise_eq_eq: โˆ€ {w : โ„•} {x y : Bitvec w}, (โˆ€ (i : Fin w), x[i] = y[i]) โ†” x = y
bitwise_eq_eq
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w} : (forall
i: Fin w
i
:
Fin: โ„• โ†’ Type
Fin
w,
x: Bitvec w
x
[
i: Fin w
i
] =
y: Bitvec w
y
[
i: Fin w
i
]) โ†”
x: Bitvec w
x
=
y: Bitvec w
y
:= โŸจ
Vector.ext: โˆ€ {n : โ„•} {ฮฑ : Type ?u.235454} {v w : Vector ฮฑ n}, (โˆ€ (m : Fin n), Vector.get v m = Vector.get w m) โ†’ v = w
Vector.ext
, fun
h: ?m.235489
h
_: ?m.235492
_
=>
h: ?m.235489
h
โ–ธ
rfl: โˆ€ {ฮฑ : Sort ?u.235494} {a : ฮฑ}, a = a
rfl
โŸฉ theorem
ext_get?: โˆ€ {w : โ„•} {x y : Bitvec w}, (โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i) โ†’ x = y
ext_get?
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w} (
h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i
h
: โˆ€
i: ?m.235528
i
,
x: Bitvec w
x
.
toList: {ฮฑ : Type ?u.235532} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235537} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.235528
i
=
y: Bitvec w
y
.
toList: {ฮฑ : Type ?u.235543} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235546} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.235528
i
) :
x: Bitvec w
x
=
y: Bitvec w
y
:=

Goals accomplished! ๐Ÿ™
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y
x: List Bool

y: Bitvec (List.length x)

h: โˆ€ (i : โ„•), List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i = List.get? (Vector.toList y) i


mk
{ val := x, property := (_ : List.length x = List.length x) } = y
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y
x, y: List Bool

hy: List.length y = List.length x

h: โˆ€ (i : โ„•), List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i = List.get? (Vector.toList { val := y, property := hy }) i


mk.mk
{ val := x, property := (_ : List.length x = List.length x) } = { val := y, property := hy }
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y

Goals accomplished! ๐Ÿ™
@[simp] theorem
toList_cong: โˆ€ {wโ‚ wโ‚‚ : โ„•} (h : wโ‚ = wโ‚‚) (b : Bitvec wโ‚), Vector.toList (Bitvec.cong h b) = Vector.toList b
toList_cong
{
wโ‚: โ„•
wโ‚
wโ‚‚: โ„•
wโ‚‚
:
Nat: Type
Nat
} (
h: wโ‚ = wโ‚‚
h
:
wโ‚: โ„•
wโ‚
=
wโ‚‚: โ„•
wโ‚‚
) (
b: Bitvec wโ‚
b
:
Bitvec: โ„• โ†’ Type
Bitvec
wโ‚: โ„•
wโ‚
) : (
Bitvec.cong: {a b : โ„•} โ†’ a = b โ†’ Bitvec a โ†’ Bitvec b
Bitvec.cong
h: wโ‚ = wโ‚‚
h
b: Bitvec wโ‚
b
).
toList: {ฮฑ : Type ?u.235705} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
=
b: Bitvec wโ‚
b
.
toList: {ฮฑ : Type ?u.235713} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
:=

Goals accomplished! ๐Ÿ™
wโ‚, wโ‚‚: โ„•

h: wโ‚ = wโ‚‚

b: Bitvec wโ‚


wโ‚: โ„•

b: Bitvec wโ‚


Vector.toList (Bitvec.cong (_ : wโ‚ = wโ‚) b) = Vector.toList b
wโ‚: โ„•

b: Bitvec wโ‚


Vector.toList (Bitvec.cong (_ : wโ‚ = wโ‚) b) = Vector.toList b
wโ‚, wโ‚‚: โ„•

h: wโ‚ = wโ‚‚

b: Bitvec wโ‚



Goals accomplished! ๐Ÿ™
theorem
get?_shl: โˆ€ {n : โ„•} (x : Bitvec n) (i j : โ„•), List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
get?_shl
(
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.235775
n
) (i j :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
shl
i).
toList: {ฮฑ : Type ?u.235790} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235795} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
j = if i + j <
n: ?m.235775
n
then
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.235851} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235854} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(i + j) else if j <
n: ?m.235775
n
then
false: Bool
false
else
none: {ฮฑ : Type ?u.235984} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (Bitvec.cong (_ : n - i + min n i = n) (Vector.append (Vector.drop i x) (Vector.replicate (min n i) false)))) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool


mk
List.get? (Vector.toList (Bitvec.cong (_ : List.length x - i + min (List.length x) i = List.length x) (Vector.append (Vector.drop i { val := x, property := (_ : List.length x = List.length x) }) (Vector.replicate (min (List.length x) i) false)))) j = if i + j < List.length x then List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) (i + j) else if j < List.length x then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool


mk
List.get? (List.drop i x ++ List.replicate (min (List.length x) i) false) j = if i + j < List.length x then List.get? x (i + j) else if j < List.length x then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
List.get? (List.drop i x) j = List.get? x (i + j)
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
List.get? x (i + j) = List.get? x (i + j)
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
some (List.get (List.replicate (min (List.length x) i) false) { val := j - List.length (List.drop i x), isLt := ?mk.inr.inl }) = some false
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x



Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
get?_ushr: โˆ€ {n : โ„•} (x : Bitvec n) (i j : โ„•), List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
get?_ushr
(
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.243378
n
) (i j :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
ushr: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
ushr
i).
toList: {ฮฑ : Type ?u.243393} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.243398} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
j = if j <
x: Bitvec n
x
.
length: {ฮฑ : Type ?u.243405} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ โ„•
length
then if j < i then
some: {ฮฑ : Type ?u.243438} โ†’ ฮฑ โ†’ Option ฮฑ
some
false: Bool
false
else
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.243441} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.243444} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(j - i) else
none: {ฮฑ : Type ?u.243491} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (fillShr x i false)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool


mk
List.get? (Vector.toList (fillShr { val := x, property := (_ : List.length x = List.length x) } i false)) j = if j < Vector.length { val := x, property := (_ : List.length x = List.length x) } then if j < i then some false else List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool


mk
List.get? (List.replicate (min (List.length x) i) false ++ List.take (List.length x - i) x) j = if j < Vector.length { val := x, property := (_ : List.length x = List.length x) } then if j < i then some false else List.get? x (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
some (List.get (List.replicate (min (List.length x) i) false) { val := j, isLt := ?mk.inl.inl }) = some false
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x



Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x



Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
get?_and: โˆ€ {n : โ„•} (x y : Bitvec n) (i : โ„•), List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)
get?_and
(
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.261948
n
) (i :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
and: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
and
y: Bitvec n
y
).
toList: {ฮฑ : Type ?u.261963} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.261968} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i = do return
(โ† x.toList.get? i): ?m.262050
(โ†
x: Bitvec n
x
(โ† x.toList.get? i): ?m.262050
.
toList: {ฮฑ : Type ?u.262040} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
(โ† x.toList.get? i): ?m.262050
.
get?: {ฮฑ : Type ?u.262043} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(โ† x.toList.get? i): ?m.262050
i
(โ† x.toList.get? i): ?m.262050
)
&&
(โ† y.toList.get? i): ?m.262105
(โ†
y: Bitvec n
y
(โ† y.toList.get? i): ?m.262105
.
toList: {ฮฑ : Type ?u.262096} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
(โ† y.toList.get? i): ?m.262105
.
get?: {ฮฑ : Type ?u.262099} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(โ† y.toList.get? i): ?m.262105
i
(โ† y.toList.get? i): ?m.262105
)
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk
List.get? (Vector.toList (Bitvec.and { val := x, property := (_ : List.length x = List.length x) } y)) i = do let __do_lift โ† List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk
List.get? (Vector.toList (Bitvec.and { val := x, property := (_ : List.length x = List.length x) } { val := y, property := hy })) i = do let __do_lift โ† List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i let __do_lift_1 โ† List.get? (Vector.toList { val := y, property := hy }) i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk.none
(Option.bind (Option.map and none) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† none let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† some valโœ let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk.none
(Option.bind (Option.map and none) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† none let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† some valโœ let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some.none
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g none) = do let __do_lift โ† some valโœ let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœยน, valโœ: Bool


mk.mk.some.some
(Option.bind (Option.map and (some valโœยน)) fun g => Option.map g (some valโœ)) = do let __do_lift โ† some valโœยน let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk.none.none
(Option.bind (Option.map and none) fun g => Option.map g none) = do let __do_lift โ† none let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.none.some
(Option.bind (Option.map and none) fun g => Option.map g (some valโœ)) = do let __do_lift โ† none let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some.none
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g none) = do let __do_lift โ† some valโœ let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœยน, valโœ: Bool


mk.mk.some.some
(Option.bind (Option.map and (some valโœยน)) fun g => Option.map g (some valโœ)) = do let __do_lift โ† some valโœยน let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
theorem
get?_ofInt_neg_one: โˆ€ {w i : โ„•}, List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
get?_ofInt_neg_one
: (
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec (Nat.succ n)
Bitvec.ofInt
w: ?m.313213
w
(-
1: ?m.313262
1
)).
toList: {ฮฑ : Type ?u.313279} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.313282} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.313256
i
= if
i: ?m.313256
i
โ‰ค
w: ?m.313213
w
then
some: {ฮฑ : Type ?u.313305} โ†’ ฮฑ โ†’ Option ฮฑ
some
true: Bool
true
else
none: {ฮฑ : Type ?u.313308} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (true :: List.replicate w true) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (true :: List.replicate w true) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (List.replicate (w + 1) true) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (List.replicate (w + 1) true) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none
w, i: โ„•

h: i โ‰ค w


inl
some (List.get (List.replicate (w + 1) true) { val := i, isLt := ?inl }) = some true
w, i: โ„•

h: i โ‰ค w


inl

Goals accomplished! ๐Ÿ™

inr
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i โ‰ค w then some true else none

inr

inr

inr

inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
-- from InstCombine/Shift:279 theorem
shl_ushr_eq_and_shl: โˆ€ {w : โ„•} {x C : Bitvec (Nat.succ w)}, shl (ushr x (Bitvec.toNat C)) (Bitvec.toNat C) = Bitvec.and x (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))
shl_ushr_eq_and_shl
{w :
Nat: Type
Nat
} {x C :
Bitvec: โ„• โ†’ Type
Bitvec
w.
succ: โ„• โ†’ โ„•
succ
} :
Bitvec.shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.shl
(
Bitvec.ushr: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.ushr
x C.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) C.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
Bitvec.and: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.and
x (
Bitvec.shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.shl
(
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec (Nat.succ n)
Bitvec.ofInt
w (-
1: ?m.316004
1
)) C.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) :=

Goals accomplished! ๐Ÿ™

h
(if Bitvec.toNat C + i < Nat.succ w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < Nat.succ w then some false else none) = List.get? (Vector.toList (Bitvec.and x (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C)))) i

h
(if Bitvec.toNat C + i < Nat.succ w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < Nat.succ w then some false else none) = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))) i pure (__do_lift && __do_lift_1)

h
(if Bitvec.toNat C + i < Nat.succ w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < Nat.succ w then some false else none) = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))) i pure (__do_lift && __do_lift_1)

h
(if Bitvec.toNat C + i โ‰ค w then if Bitvec.toNat C + i โ‰ค w then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i โ‰ค w then some false else none) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (if Bitvec.toNat C + i โ‰ค w then if Bitvec.toNat C + i โ‰ค w then some true else none else if i โ‰ค w then some false else none) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: Bitvec.toNat C + i < Bitvec.toNat C


h.inl.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: ยฌBitvec.toNat C + i < Bitvec.toNat C


h.inl.inr
List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: Bitvec.toNat C + i < Bitvec.toNat C


h.inl.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: Bitvec.toNat C + i < Bitvec.toNat C


h.inl.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: ยฌBitvec.toNat C + i < Bitvec.toNat C


h.inl.inr
List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: ยฌBitvec.toNat C + i < Bitvec.toNat C


h.inl.inr
List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: ยฌBitvec.toNat C + i < Bitvec.toNat C


h.inl.inr
List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: Bitvec.toNat C + i โ‰ค w

hโ‚‚: ยฌBitvec.toNat C + i < Bitvec.toNat C


h.inl.inr
List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: i โ‰ค w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: w < Bitvec.toNat C + i

hโ‚ƒ: w < i


h.inr.inr
w < i
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: w < Bitvec.toNat C + i

hโ‚ƒ: w < i


h.inr.inr
w < i
w: โ„•

x, C: Bitvec (Nat.succ w)

i: โ„•

hโ‚: ยฌBitvec.toNat C + i โ‰ค w

hโ‚ƒ: ยฌi โ‰ค w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
-- A lot of this should probably go to a differet file here and not Mathlib inductive
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} :
Option: Type ?u.331617 โ†’ Type ?u.331617
Option
ฮฑ: Type u
ฮฑ
โ†’
Option: Type ?u.331620 โ†’ Type ?u.331620
Option
ฮฑ: Type u
ฮฑ
โ†’
Prop: Type
Prop
|
bothSome: โˆ€ {ฮฑ : Type u} {x y : ฮฑ}, x = y โ†’ Refinement (some x) (some y)
bothSome
{
x: ฮฑ
x
y: ฮฑ
y
:
ฮฑ: Type u
ฮฑ
} :
x: ฮฑ
x
=
y: ฮฑ
y
โ†’
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
(
some: {ฮฑ : Type ?u.331636} โ†’ ฮฑ โ†’ Option ฮฑ
some
x: ฮฑ
x
) (
some: {ฮฑ : Type ?u.331639} โ†’ ฮฑ โ†’ Option ฮฑ
some
y: ฮฑ
y
) |
noneAny: โˆ€ {ฮฑ : Type u} {x? : Option ฮฑ}, Refinement none x?
noneAny
{
x?: Option ฮฑ
x?
:
Option: Type ?u.331647 โ†’ Type ?u.331647
Option
ฮฑ: Type u
ฮฑ
} :
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
none: {ฮฑ : Type ?u.331651} โ†’ Option ฮฑ
none
x?: Option ฮฑ
x?
namespace Refinement theorem
Refinement.refl: โˆ€ {ฮฑ : Type u} (x : Option ฮฑ), Refinement x x
Refinement.refl
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} : โˆ€
x: Option ฮฑ
x
:
Option: Type ?u.331684 โ†’ Type ?u.331684
Option
ฮฑ: Type u
ฮฑ
,
Refinement: {ฮฑ : Type ?u.331687} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
x: Option ฮฑ
x
:=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

x: Option ฮฑ


ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

x: Option ฮฑ


ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u


none
Refinement none none
ฮฑ: Type u

valโœ: ฮฑ


some
Refinement (some valโœ) (some valโœ)
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

valโœ: ฮฑ


some
Refinement (some valโœ) (some valโœ)
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

valโœ: ฮฑ


some.a
valโœ = valโœ
ฮฑ: Type u

valโœ: ฮฑ


some.a
valโœ = valโœ
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x

Goals accomplished! ๐Ÿ™
theorem
Refinement.trans: โˆ€ {ฮฑ : Type u} (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
Refinement.trans
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} : โˆ€
x: Option ฮฑ
x
y: Option ฮฑ
y
z: Option ฮฑ
z
:
Option: Type ?u.331798 โ†’ Type ?u.331798
Option
ฮฑ: Type u
ฮฑ
,
Refinement: {ฮฑ : Type ?u.331802} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
y: Option ฮฑ
y
โ†’
Refinement: {ฮฑ : Type ?u.331808} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
y: Option ฮฑ
y
z: Option ฮฑ
z
โ†’
Refinement: {ฮฑ : Type ?u.331812} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
z: Option ฮฑ
z
:=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

z: Option ฮฑ

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ

hโ‚‚: Refinement (some yโœ) z


bothSome
Refinement (some xโœ) z
ฮฑ: Type u

y, z: Option ฮฑ

hโ‚‚: Refinement y z


noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

z: Option ฮฑ

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ

hโ‚‚: Refinement (some yโœ) z


bothSome
Refinement (some xโœ) z
ฮฑ: Type u

y, z: Option ฮฑ

hโ‚‚: Refinement y z


noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)
ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)
ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
Refinement (some yโœ) (some y)
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z

Goals accomplished! ๐Ÿ™
instance: {ฮฑ : Type u} โ†’ [inst : DecidableEq ฮฑ] โ†’ DecidableRel Refinement
instance
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} [
DecidableEq: Sort ?u.332452 โ†’ Sort (max1?u.332452)
DecidableEq
ฮฑ: Type u
ฮฑ
] :
DecidableRel: {ฮฑ : Sort ?u.332461} โ†’ (ฮฑ โ†’ ฮฑ โ†’ Prop) โ†’ Sort (max1?u.332461)
DecidableRel
(@
Refinement: {ฮฑ : Type ?u.332463} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
ฮฑ: Type u
ฮฑ
) :=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ


none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ

valโœ: ฮฑ


some
Decidable (Refinement (some valโœ) y)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ


none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ

valโœ: ฮฑ


some
Decidable (Refinement (some valโœ) y)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none.h
Refinement none none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none.h
Refinement none none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some.h
Refinement none (some valโœ)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some.h
Refinement none (some valโœ)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none.h
ยฌRefinement (some valโœ) none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none.h
ยฌRefinement (some valโœ) none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ

h: Refinement (some valโœ) none


some.none.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ

h: Refinement (some valโœ) none


some.none.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ


some.some
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

h: Refinement (some val) (some val')


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

h: Refinement (some val) (some val')


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

aโœ: val = val'


some.some.isFalse.h.bothSome
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

aโœ: val = val'


some.some.isFalse.h.bothSome
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h
Refinement (some val) (some val')
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h
Refinement (some val) (some val')
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h.a
val = val'
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h.a
val = val'
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
end Refinement infix:50 " โŠ‘ " =>
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
instance: {w : โ„•} โ†’ DecidableEq (Bitvec w)
instance
{w :
Nat: Type
Nat
} :
DecidableEq: Sort ?u.341340 โ†’ Sort (max1?u.341340)
DecidableEq
(
Bitvec: โ„• โ†’ Type
Bitvec
w) :=
inferInstance: {ฮฑ : Sort ?u.341346} โ†’ [i : ฮฑ] โ†’ ฮฑ
inferInstance
theorem
toInt_injective: โˆ€ {w : โ„•}, Function.Injective Bitvec.toInt
toInt_injective
: โˆ€ {w :
Nat: Type
Nat
},
Function.Injective: {ฮฑ : Sort ?u.341575} โ†’ {ฮฒ : Sort ?u.341574} โ†’ (ฮฑ โ†’ ฮฒ) โ†’ Prop
Function.Injective
(
Bitvec.toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
Bitvec.toInt
:
Bitvec: โ„• โ†’ Type
Bitvec
w โ†’
โ„ค: Type
โ„ค
) | 0, โŸจ[],
_: List.length [] = 0
_
โŸฉ, โŸจ[], _โŸฉ,
rfl: โˆ€ {ฮฑ : Sort ?u.341608} {a : ฮฑ}, a = a
rfl
=>
rfl: โˆ€ {ฮฑ : Sort ?u.341703} {a : ฮฑ}, a = a
rfl
| n+1, โŸจ
a: Bool
a
::x,
hx: List.length (a :: x) = n + 1
hx
โŸฉ, โŸจ
b: Bool
b
::y,
hy: List.length (b :: y) = n + 1
hy
โŸฉ,
h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }
h
=>

Goals accomplished! ๐Ÿ™
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (false :: x) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (true :: x) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (false :: x) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (true :: x) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: Bitvec.toNat { val := x, property := (_ : Nat.pred (List.length (false :: x)) = Nat.pred (Nat.succ (n + 0))) } = Bitvec.toNat { val := y, property := (_ : Nat.pred (List.length (false :: y)) = Nat.pred (Nat.succ (n + 0))) }


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat { val := x, property := (_ : Nat.pred (List.length (false :: x)) = Nat.pred (Nat.succ (n + 0))) }) = (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat { val := y, property := (_ : Nat.pred (List.length (false :: y)) = Nat.pred (Nat.succ (n + 0))) })


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: Bitvec.toNat (Bitvec.not { val := x, property := (_ : Nat.pred (List.length (true :: x)) = Nat.pred (Nat.succ (n + 0))) }) = Bitvec.toNat (Bitvec.not { val := y, property := (_ : Nat.pred (List.length (true :: y)) = Nat.pred (Nat.succ (n + 0))) })


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat (Bitvec.not { val := x, property := (_ : Nat.pred (List.length (true :: x)) = Nat.pred (Nat.succ (n + 0))) })) = (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat (Bitvec.not { val := y, property := (_ : Nat.pred (List.length (true :: y)) = Nat.pred (Nat.succ (n + 0))) }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_zero: โˆ€ {w : โ„•}, Bitvec.toInt 0 = 0
toInt_zero
{w :
Nat: Type
Nat
} : (
0: ?m.347933
0
:
Bitvec: โ„• โ†’ Type
Bitvec
w).
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.347965
0
:=

Goals accomplished! ๐Ÿ™

(match w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

Goals accomplished! ๐Ÿ™

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0
w: โ„•

thisโœ: Vector.head 0 = false

this: Vector.tail 0 = 0


succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
toInt_eq_zero: โˆ€ {w : โ„•} (b : Bitvec w), Bitvec.toInt b = 0 โ†” b = 0
toInt_eq_zero
{w :
Nat: Type
Nat
} (
b: Bitvec w
b
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
b: Bitvec w
b
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.350633
0
โ†”
b: Bitvec w
b
=
0: ?m.350659
0
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_one: โˆ€ {w : โ„•}, 1 < w โ†’ Bitvec.toInt 1 = 1
toInt_one
: โˆ€ {w :
โ„•: Type
โ„•
} (
_hw: 1 < w
_hw
:
1: ?m.350769
1
< w),
Bitvec.toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
Bitvec.toInt
(
1: ?m.350808
1
:
Bitvec: โ„• โ†’ Type
Bitvec
w) =
1: ?m.350833
1
| w+2, _ =>

Goals accomplished! ๐Ÿ™
w: โ„•

xโœ: 1 < w + 2


w: โ„•

xโœ: 1 < w + 2

this: Vector.head 1 = false


w: โ„•

xโœ: 1 < w + 2


w: โ„•

xโœ: 1 < w + 2

thisโœ: Vector.head 1 = false

this: Vector.tail 1 = 1


w: โ„•

xโœ: 1 < w + 2



Goals accomplished! ๐Ÿ™
-- from InstCombine/:805 theorem
Warning: declaration uses 'sorry'
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
:
Bitvec: โ„• โ†’ Type
Bitvec
w} (
hw: w > 1
hw
: w >
1: ?m.353560
1
) (
hx: x โ‰  0
hx
:
x: Bitvec w
x
โ‰ 
0: ?m.353593
0
) :
Bitvec.sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
Bitvec.sdiv?
1: ?m.353621
1
x: Bitvec w
x
=
Option.some: {ฮฑ : Type ?u.353644} โ†’ ฮฑ โ†’ Option ฮฑ
Option.some
(
Bitvec.select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
Bitvec.select
(((
x: Bitvec w
x
+
1: ?m.353657
1
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
<
3: ?m.353733
3
) ::แตฅ
Vector.nil: {ฮฑ : Type ?u.353785} โ†’ Vector ฮฑ 0
Vector.nil
)
x: Bitvec w
x
0: ?m.353788
0
) :=

Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)

Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


x: Bitvec 0

hw: 0 > 1

hx: x โ‰  0


x: Bitvec 0

hw: 0 > 1

hx: x โ‰  0


w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0



Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0

hw0: w โ‰  0


ofInt' w (1 / Bitvec.toInt x) = if (Bitvec.toNat x + 1) % 2 ^ w < 3 then x else 0
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)

Goals accomplished! ๐Ÿ™
theorem
Warning: declaration uses 'sorry'
: (
Bitvec.sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
Bitvec.sdiv?
(
Bitvec.ofInt': (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt'
w: ?m.354558
w
1: ?m.354586
1
)
x: ?m.354578
x
) โŠ‘
Option.some: {ฮฑ : Type ?u.354589} โ†’ ฮฑ โ†’ Option ฮฑ
Option.some
(
Bitvec.select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
Bitvec.select
((
Nat.blt: โ„• โ†’ โ„• โ†’ Bool
Nat.blt
(
Bitvec.add: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.add
x: ?m.354578
x
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.354558
w
1: ?m.354599
1
)).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.354558
w
3: ?m.354609
3
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) ::แตฅ
Vector.nil: {ฮฑ : Type ?u.354617} โ†’ Vector ฮฑ 0
Vector.nil
)
x: ?m.354578
x
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.354558
w
0: ?m.354620
0
)) :=
sorry: ?m.354630
sorry
def
beq: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Bool
beq
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Bool: Type
Bool
:=
x: Bitvec w
x
=
y: Bitvec w
y
def
fromBool: Bool โ†’ Bitvec 1
fromBool
:
Bool: Type
Bool
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.354732
1
:= fun
b: ?m.354745
b
=>
b: ?m.354745
b
::แตฅ
Vector.nil: {ฮฑ : Type ?u.354752} โ†’ Vector ฮฑ 0
Vector.nil
instance: Coe Bool (Bitvec 1)
instance
:
Coe: semiOutParam (Sort ?u.354789) โ†’ Sort ?u.354788 โ†’ Sort (max(max1?u.354789)?u.354788)
Coe
Bool: Type
Bool
(
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.354791
1
) := โŸจ
fromBool: Bool โ†’ Bitvec 1
fromBool
โŸฉ end Bitvec